<template>
  <p-table
    class="table-list-container"
    row-key="id"
    :columns="columns"
    bordered
    v-bind="$attrs"
    v-on="$listeners"
  >
    <a
      slot="bizNo"
      slot-scope="text, record"
      @click="$emit('number-click', record)"
    >
      {{ text }}
    </a>
  </p-table>
</template>

<script>
export default {
  data() {
    return {};
  },
  computed: {
    nodeOptions() {
      return (
        this.$store.state.dictionary.dict['business_stage_process_node'] || {}
      );
    },
    stateOptions() {
      return this.$store.state.dictionary.dict['business_status'] || {};
    },
    orgOptions() {
      return this.$store.getters.getOrg({
        code: 'ltcsmsizebu',
      });
    },
    transferOptions() {
      return (
        this.$store.state.dictionary.dict['business_transfer_status'] || {}
      );
    },
    columns() {
      const columns = [
        {
          align: 'center',
          title: '序号',
          width: 60,
          customRender(t, r, index) {
            return parseInt(index) + 1;
          },
        },
        {
          align: 'center',
          title: '单据类型',
          dataIndex: 'bizType',
          width: 160,
          ellipsis: true,
          sorter: true,
          customRender(t) {
            return t === 'leads' ? '线索' : '商机';
          },
        },
        {
          align: 'center',
          title: '线索/商机编号',
          dataIndex: 'bizNo',
          width: 150,
          sorter: true,
          scopedSlots: { customRender: 'bizNo' },
        },
        {
          align: 'center',
          title: '线索/商机名称',
          dataIndex: 'bizName',
          width: 160,
          ellipsis: true,
          sorter: true,
        },
        {
          align: 'center',
          title: '创建人',
          dataIndex: 'bizCreateUserName',
          width: 100,
          sorter: true,
          ellipsis: true,
        },
        {
          align: 'center',
          title: '创建时间',
          dataIndex: 'bizCreateTime',
          width: 160,
          sorter: true,
          ellipsis: true,
        },
        {
          align: 'center',
          title: '失销类别',
          dataIndex: 'categoryName',
          width: 100,
          sorter: true,
          ellipsis: true,
        },
        {
          align: 'center',
          title: '失销细类',
          dataIndex: 'itemName',
          width: 100,
          sorter: true,
          ellipsis: true,
        },
        {
          align: 'center',
          title: '失销说明',
          dataIndex: 'remark',
          width: 160,
          sorter: true,
          ellipsis: true,
        },
        {
          align: 'center',
          title: '失销人',
          dataIndex: 'createUserName',
          width: 100,
          sorter: true,
          ellipsis: true,
        },
        {
          align: 'center',
          title: '失销时间',
          dataIndex: 'createTime',
          width: 160,
          sorter: true,
          ellipsis: true,
        },
      ];
      return columns;
    },
  },
  methods: {},
};
</script>

<style lang="less" scoped>
.table-list-container {
  margin-top: 20px;
}
</style>
